const state = {
  catchList: [],
  pageParamsMap: new Map()
}

const mutations = {
  KEEP_ALIVE: (state, oneCatch) => {
    let index = state.catchList.indexOf(oneCatch)
    if (index == -1) state.catchList.push(oneCatch)
  },
  DELONE_KEEP_ALIVE: (state, oneCatch) => {
    let index = state.catchList.indexOf(oneCatch)
    if (index != -1) state.catchList.splice(index, 1)
  },
  NO_KEEP_ALIVE: (state) => {
    state.catchList = []
  },
  PUT_PAGE_PARAMS(state, page_param) {
    state.pageParamsMap.set(page_param.uuid, page_param.data)
  }
}

export default {
  namespaced: true,
  state,
  mutations
}
